<template>
	<view class="main" style="background-color: #e4ecf7;min-height: 100vh;">
		<!-- 移除 v-for 从根元素 -->
		<!-- 在内部容器元素上使用 v-for -->
		<view v-for="(item,index) in productList" :key="index">
			<view class="user_header_box">
			</view>
			<view class="user_amount_box">
				<view class="user_level">
					<image class="icon" src="/static/tourist.jpg"></image>
					<view class="level_desc_box">
						<view class="title">{{ item.username }}</view>
						<view class="desc">{{ item.level }}</view>
					</view>
					<u-icon class="right_icon" name="more-dot-fill"></u-icon>
				</view>
			</view>

			<view class="loan_box">
				<view class="loan_title_box">
					<view class="title" style="color: darkcyan;">
						<span>{{ item.product }}</span>
					</view>
					<view class="link">
						{{ item.commentDate }}
					</view>
				</view>
				<view class="date" style="margin-left: 36rpx;">
					{{ item.contant }}
				</view>
				<uni-group>
					<image :src="item.Image" class="image-fixed-size"></image>
				</uni-group>
		<view class="share-like-buttons">
			<view class="share-button">
				分享
				<u-icon name="share" color="#2979ff" size="28"></u-icon>
			</view>
			<view class="like-button">
				点赞
				<u-icon name="thumb-up" color="#2979ff" size="28"></u-icon>
			</view>
		</view>
			</view>
			<view class="foot_line">
			
			</view>
		</view>
	</view>
</template>

<script>
	import { store } from '@/uni_modules/uni-id-pages/common/store.js'
		import { get, post, removeToken } from '@/utils/api.js';
	export default {
		data() {
			return {
				productList:[
					{
						id:1,
						username:'匿名买家',
						commentDate:'2024年5月12日',
						contant:'哈哈越看越喜欢',
						Image:'../../static/cat.jpg',
						level:'好评',
						product:'橘猫'
					},
					{
						id:2,
						username:'匿名买家',
						commentDate:'2024年5月12日',
						contant:'哈哈越看越喜欢',
						Image:'../../static/cat.jpg',
						level:'好评',
						product:'橘猫'
					},
					{
						id:3,
						username:'匿名买家',
						commentDate:'2024年5月12日',
						contant:'哈哈越看越喜欢',
						Image:'../../static/cat.jpg',
						level:'好评',
						product:'橘猫'
					},
					{
						id:4,
						username:'匿名买家',
						commentDate:'2024年5月12日',
						contant:'哈哈越看越喜欢',
						Image:'../../static/cat.jpg',
						level:'好评',
						product:'橘猫'
					}
				]
			}
		},
		onLoad() {

		},
		methods: {
         getMydefultAddress() {
          post('/comment/getCommentByProductName',
          {
			  commentStoreName:uni.getStorageSync('commentStoreName'),
			  commentStoreProductName:uni.getStorageSync('commentStoreProductName')
          }, {
            needToken: true, 
          	success: (res) => {
          	if (res.statusCode === 200) {
               console.log(res)
          	}
            }
          }); 
         }
		},
		
		created() {
			uni.getStorageSync('commentStoreProductName')
			 uni.getStorageSync('commentStoreName')
		}
	}
</script>

<style lang="scss" scoped>
	.image-fixed-size {
	  width: 130px; /* 设定宽度 */
	  height: 130px; /* 设定高度 */
	  object-fit: contain; /* 图片会被缩放到适应容器，不会裁剪图片内容 */
	  border-radius: 10px;
	  margin: 40rpx;
	}
	.user_header_box{
		height: 200rpx;
		width: 100%;
		// background-image: url(../../static/user/head_bg.png);
		background-size: 100% 100%;
		display: flex;
		align-items: center;
		justify-content: left;
		.avatar_box{
			margin-left: 80rpx;
			.img{
				height: 120rpx;
				width: 120rpx;
			}
		}
		.user_info{
			color: #fff;
			margin-left: 20rpx;
			.name{
				
			}
			.uid{
				
			}
		}
	}
	.user_amount_box{
		width: 90%;
		margin: -90rpx auto 0 auto;
		.user_level{
			border-radius: 10rpx 10rpx 0 0;
			background-color: #e2eefe;
			padding: 10rpx 14rpx;
			display: flex;
			align-items: center;
			.icon{
				border-radius: 50%;
				height: 60rpx;
				width: 60rpx;
			}
			.level_desc_box{
				margin-left: 20rpx;
				.title{
					font-size: 28rpx;
				}
				.desc{
					font-size: 20rpx;
					color: #808080;
				}
			}
			.right_icon{
				height: 26rpx;
				width: 16rpx;
				margin-left: auto;
				padding-right: 50rpx;
			}
		}
		.amount_box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			background-color: #fff;
			border-radius: 0 0 10rpx 10rpx;
			padding: 40rpx 60rpx;
			.amount{
				font-size: 46rpx;
			}
			.now_with{
				background-color: #ffa415;
				color: #fff;
				padding: 8rpx 30rpx;
				border-radius: 5rpx;
			}
		}
	}
	.user_tab_box{
		background-color: #fff;
		width: 90%;
		margin: 20rpx auto;
		border-radius: 10rpx;
		padding: 10rpx 20rpx;
		padding-bottom: 20rpx;
		box-sizing: border-box;
		.tab_title{
			font-size: 30rpx;
		}
		.tab_list_box{
			margin-top: 20rpx;
			display: flex;
			flex-wrap: wrap;
			.list_item{
				width: 25%;
				text-align: center;
				margin: 16rpx 0;
				.icon{
					height: 80rpx;
					width: 80rpx;
				}
				.text{
					color: #666666;
					margin-top: -10rpx;
					font-size: 26rpx;
				}
			}
		}
	}
	.loan_box{
		background-color: #fff;
		width: 90%;
		margin: 20rpx auto;
		border-radius: 10rpx;
		padding: 10rpx 20rpx;
		padding-bottom: 20rpx;
		box-sizing: border-box;
		position: relative;
				& > .share-like-buttons {
					position: absolute;
					bottom: 20rpx;
					width: 100%;
					display: flex;
					justify-content: space-between;
					padding: 0 50rpx; /* 添加左右内边距，以便按钮不会紧贴边缘 */
				}
		.loan_title_box{
			display: flex;
			align-items: center;
			padding-top: 6rpx;
			.title{
				font-size: 30rpx;
			}
			.link{
				margin-left: auto;
				color: #797979;
				font-size: 20rpx;
			}
		}
		.loan_list{
			margin-top: 30rpx;
			.list_item{
				padding: 0 10rpx;
				border-bottom: 1px solid #e9e9e9;
				margin-top: 20rpx;
				.item_head{
					display: flex;
					align-items: center;
					.pic{
						height: 40rpx;
						width: 30rpx;
					}
					.loan_info{
						margin-left: 20rpx;
						.name{
							color: #797979;
							font-weight: 600;
						}
						.date{
							color: #797979;
							margin-top: 6rpx;
						}
					}
					.join_btn{
						background-color: #2979ff;
						color: #fff;
						margin-left: auto;
						margin-right: 20rpx;
						padding: 6rpx 30rpx;
						border-radius: 30rpx;
						font-size: 28rpx;
					}
				}

			}
		}
	}
	.foot_line{
		display: flex;
		align-items: center;
		justify-content: center;
		padding-bottom: 20rpx;
		color: #5f5f5f;
		.line{
			width: 200rpx;
			border-bottom: 1px solid #5f5f5f;
		}
	}
	.share-like-buttons {
			.share-button,
			.like-button {
				display: flex;
				align-items: center;
				gap: 12rpx; /* 在文字和图标之间添加一些间隙 */
			}
		}
	</style>
</style>